package com.mcxx.modules.miniSalvation.order.service.read;

import com.mcxx.modules.base.utils.QueryParamUtil;
import com.mcxx.modules.miniSalvation.order.dao.read.InspectionBatchReadDao;
import com.mcxx.modules.miniSalvation.order.entity.InspectionAuditEntity;
import com.mcxx.modules.miniSalvation.order.entity.InspectionBatchEntity;
import com.mcxx.modules.miniSalvation.order.param.InspectionBatchParam;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@TaTransactional(readOnly = true)
public class InspectionBatchReadService {

    @Autowired
    private InspectionBatchReadDao inspectionBatchReadDao;


    public List<InspectionBatchEntity> listAll() {
    	return inspectionBatchReadDao.listAll();
    }



    public InspectionBatchEntity getById(String id) {
    	return inspectionBatchReadDao.getById(id);
    }



    public Page listByCondition(InspectionBatchParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        inspectionBatchReadDao.beginPager(pageParam);
        List<InspectionBatchEntity> list = inspectionBatchReadDao.listByCondition(param);


        return inspectionBatchReadDao.endPager(list);
    }


    public Page listAuditBatchByCondition(InspectionBatchParam param, PageParam pageParam, UserAccountVo curUserAccount) {

        QueryParamUtil.setBaseParamValue(param,curUserAccount);

        inspectionBatchReadDao.beginPager(pageParam);
        List<InspectionAuditEntity> list = inspectionBatchReadDao.listAuditBatchByCondition(param);


        return inspectionBatchReadDao.endPager(list);
    }
}
